# *****************************************************************************
#    Copyright (C), 2022 by D2X studio. All rights reserved.                  *
#                                                                             *
#    @file:      Makefile
#    @owner:     zhengjian.xie@gmail.com                                      *
#    @desc:                                                                   *
#    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +    *
# history:                                                                    *
#  <author>      <time>      <version>              <description>             *
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  *
#  |  Xzj |  20220411[18:16] | 1.0.0 |                  build              |  *
#  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  *
# ****************************************************************************/

CC ?= gcc
CFLAGS =

MY_FLAGS =

HDRS := $(wildcard *.h)
SRCS := $(wildcard *.c)
OBJS := $(SRCS:.c=.o)
TARGET = tcu_server tcu_client tcu_app

#$(info $(SRCS))

%.o : %.c; $(CC) $(CFLAGS) $(MY_FLAGS) -c $< -o $@

__build:
	make -f Makefile clean tcu_server
	make -f Makefile clean tcu_client
	make -f Makefile clean tcu_app
	make -f Makefile clean
clean:; -rm -rf $(OBJS)
distclean: clean; -rm -rf $(TARGET)

tcu_server: MY_FLAGS = -DTCU_SERVER
tcu_server: $(OBJS)
	$(CC) -o $@ $^

tcu_client: CFLAGS += -DTCU_CLIENT
tcu_client: $(OBJS)
	$(CC) -o $@ $^

tcu_app: CFLAGS += -DTCU_APP
tcu_app: $(OBJS)
	$(CC) -o $@ $^

PHONY += __build clean distclean
.PHONY: $(PHONY)
